package com.njtoyo.netrides.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.taxi.entity.json.PointCustomerSerializer;
import lombok.Data;
import lombok.experimental.Accessors;
import org.geolatte.geom.Point;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name = "appointment_call")
@Accessors(chain = true)
@Data
public class RideAppointment {

    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ManyToOne
    @JoinColumn(name = "customer_id")
    private User user;

    @JsonIgnore
    @Column(columnDefinition = "POINT")
    private Point origin;

    private String originName;

    /**
     * 起点详细路名
     */
    private String originPlaceName;

    @JsonIgnore
    @Column(columnDefinition = "geometry(Point,4326)")
    @JsonSerialize(using = PointCustomerSerializer.class)
    private Point destination;

    private String destinationName;

    /**
     * 目的地详细地名
     */
    private String destinationPlaceName;

    /**
     * 地区表ID
     */
    private Long areaId;

    /**
     *
     */
    private Long cantonId;

    @Enumerated
    private Znum.AppointmentPick state;

    private Date scheduleTime;

    private Integer priceMarkup;

    private Date createdAt;
    @JsonIgnore
    private Date updatedAt;

    private Integer distance;

    @JsonIgnore
    private Date pickUpTime;

    @Enumerated
    private Znum.AppointmentCtg category;

    @OneToOne
    @JoinColumn(name = "refId")
    @JsonIgnore
    private Ride ride;

    @Transient
    private String adCode;

}
